<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<c:set var="bp" value="${pageContext.request.contextPath}"/>
<jsp:include page="common/header.jsp"/>
<div id="page-wrapper">
    <div class="row">
        <div class="col-md-12">
            <h1 class="page-header">快速订购</h1>
        </div>
        <!-- /.col-lg-12 -->
    </div>
    <div class="row">
        <div class="col-md-8">

            <table class="table table-striped table-bordered table-hover">
                <thead>
                <tr>
                    <th style="width: 12%">序号</th>
                    <th style="width: 20%">用户名</th>
                    <th style="width: 10%">密码</th>
                    <td style="width: 14%">操作</td>
                </tr>
                </thead>
                <tbody>
                <c:forEach items="${userlist.list}" var="keyword" varStatus="id">
                    <tr>
                        <td>${keyword.id}</td>
                        <td>${keyword.username}</td>
                        <td>${keyword.password}</td>
                        <td><button onclick="quierk(${keyword.id})">删除</button></td>
                    </tr>
                </c:forEach>
                </tbody>
            </table>
            <ul class="pagination pagination-sm">
                <li><a href="">&laquo;</a></li>
                <li><a href="${bp}/user/list?pageno=1&pagesize=3">1</a></li>
                <li><a href="${bp}/user/list?pageno=2&pagesize=3">2</a></li>
                <li><a href="${bp}/user/list?pageno=3&pagesize=3">3</a></li>
                <li><a href="${bp}/user/list?pageno=4&pagesize=3">4</a></li>
                <li><a href="${bp}/user/list?pageno=5&pagesize=3">5</a></li>
                <li><a href="#">&raquo;</a></li>
            </ul>
        </div>

    </div>
</div>
<!-- /#page-wrapper -->

</div>
<script type="text/javascript">

    function quierk(id) {
        $.ajax({
            type:"get",
            url:"${bp}/user/deletebyid",
            data:{"id":id},
            success : function (msg) {
                if(msg == 1){
                    alert("删除成功")
                    window.location.reload()
                }else{
                    alert("删除失败")
                }
            }
        })
    }
</script>
<jsp:include page="common/forwer.jsp" />
</body>

</html>